using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace UniversalAdminSystem.Infrastructure.Configs;

/// <summary>
/// 系统权限配置类，映射配置文件
/// </summary>
/// <param name="Resource"></param>
/// <param name="Action"></param>
/// <param name="Name"></param>
public sealed record SystemPermissionConfig(
    [property: JsonPropertyName("Resource")]
    string Resource,

    [property: JsonPropertyName("Action"), Required]
    string Action,

    [property: JsonPropertyName("Name"), Required]
    string Name
);

/// <summary>
/// 系统权限配置根类，映射配置文件
/// </summary>
public sealed class SystemPermissionConfigRoot
{
    [JsonPropertyName("SystemPermissions")]
    public required IReadOnlyCollection<SystemPermissionConfig> Permissions { get; init; }
}